package com.wwdx.model;

import com.wwdx.utils.ConstantHolder;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * 产品评论表
 * @author liguoliang
 */
@Table(name = "wwdx_comment")
@Entity
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class WwdxCommentModel implements Serializable{

    @Id
    @GeneratedValue
    private Long id;
    private Long pid;
    private Long productId;
    private Long userid;
    private String content;
    /**
     * 1 主题 2 书籍
     */
    private Integer type;
    /**
     *  0 未回复 1 已回复
     */
    private Integer status;
    /**
     * 0 未推荐 1 已推荐
     */
    private Integer recommend;
    @Column(name = "gmt_created")
    @DateTimeFormat(pattern = ConstantHolder.Constant.LOCAL_DATE_TIME_PATTERN)
    private Date gmtCreated;

    @Transient
    private Boolean rest;

    @Transient
    String productName;
    @Transient
    private String nickname;
    @Transient
    private String headimg;
    @Transient
    private Integer editType;
    @Transient
    private Long likeCount;
    @Transient
    private Boolean islike;
    /**
     * 点赞人集合
     */
    @Transient
    private List<Long> userids;
    /**
     * 回复集合
     */
    @Transient
    private List<WwdxCommentModel> replys;
}
